VObject::Detect

Section: ET++ method description (n)
Updated: automatically Mon Apr 8 20:17:57 1991
Index Return to Main Contents
 

NAME

VObject::Detect - instance method  

TEMPLATE

foundItem = VObject * Detect(BoolFun compareFunction, void * compareFunctionArg)  

SPECIFIERS

public virtual  

DESCRIPTION

Detect searches a certain VObject in the VObject Tree starting at this.
Detect walks down the VObject tree, applies compareFunction to each VObject and returns the first one where the compareFunction returns TRUE.
Detect is never called directly. The interface to this method are the method FindItem and the method FindItemPtr which call Detect with different compare functions. For example, it is possible to look for a VObject with a certain id.
Detect should be overridden if the subclass contains one or more "child" VObjects to forward Detect also to its childs. The default implementation applies the compareFunction only to this.
For example, the method CompositeVObject::Detect first applies the compareFunction to every VObject in its list and at last to itself. This way of searching a tree is generally called depth-first search because it first tries to walk down the tree as deep as possible.
Another good example is the method Menu::Detect. Method is sometimes overridden.  

ARGUMENTS

BoolFun compareFunction

This function is called with the following arguments (item, item, compareFunctionArg)
whereby item contains the VObject currently visited in the VObject tree.
This function has to compare the item with the compareFunctionArg and return whether they are equal.
void * compareFunctionArg

is passed to the compareFunction
as third argument. See compareFunction.
 

RETURN ARGUMENT

VObject * foundItem

contains the first VObject
where compareFunction returns TRUE. It is NULL if compareFunction never returns TRUE.
 

CATEGORIES

detect, overrider interface

 

FIRST DEFINITION

class VObject  

FILES

implementation:
VObject.C


 

Index

NAME
TEMPLATE
SPECIFIERS
DESCRIPTION
ARGUMENTS
RETURN ARGUMENT
CATEGORIES
FIRST DEFINITION
FILES

This document was created by man2html, using the manual pages.
Time: 00:40:22 GMT, March 30, 2022